<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript">
	function check() {
		var name=$("#name").val();
		var dept=$("#dept").val();
		var date=$("#date").val();
		var status=$("#status").val();
		if (name=="") {
			alert("姓名不能为空");
			return false;
		}
		if (dept=="") {
			alert("所属部门不能为空");
			return false;
		}
		if (date=="" || !(isNaN(date) && !isNaN(Date.parse(date)))) {
			alert("考勤日期格式必须是yyyy-MM-dd格式，请检查后重新输入");
			return false;
		}
		if (status==0) {
			alert("考状态不能为空");
			return false;
		}
		return true;
	}
</script>
</head>
<body>
<center>
<form action="AddServlet" method="post" onsubmit="return check()">
	<table border="1">
		<tr><th colspan="2">添加考勤记录信息</th></tr>
		<tr><td>姓名</td><td><input type="text" id="name" name="name"> </td></tr>
		<tr><td>所属部门</td><td><input type="text" id="dept" name="dept"> </td></tr>
		<tr><td>考勤日期</td><td><input type="text" id="date" name="date"> 日期格式:yyyy-MM-dd</td></tr>
		<tr>
			<td>考勤状态</td>
			<td>
				<select name="status" id='status'>
					<option value="0">请选择考勤类型</option>
					<option value="正常">正常</option>
					<option value="迟到">迟到</option>
					<option value="早退">早退</option>
					<option value="休假">休假</option>
					<option value="外出">外出</option>
				</select>
			</td>
		 </tr>
		 <tr><td colspan="2" ><input type="submit" value="登记" ></td></tr>
	</table>
</form>
</center>
</body>
</html>